<template>
  <div>
    <template v-for="(item,index) in props.menuList" :key="item.id">
      <el-menu-item :index="item.id" v-if="item.type==='report'" class=""
                    style="border-radius: 5px" @click="handleClick(item)">
        <span class="font-18 ml-4 text-hidden-one">{{ item.name }}</span>
      </el-menu-item>
      <el-sub-menu :index="item.id" v-else class="hasChild " style="border-radius: 5px;">
        <template #title>
          <span class="font-18 ml-4 text-hidden-one">{{ item.name }}</span>
        </template>
        <rpMenuItem :menuList="item.children"></rpMenuItem>
      </el-sub-menu>
    </template>
  </div>

</template>

<script setup lang="ts">
//组件
//接口


//api
import {nextTick, reactive, ref, onMounted} from 'vue'
import {RouteRecordRaw} from "vue-router";
import useSystemStore from "@/store/modules/system/system";
import useReportStore from "@/store/modules/report/report";
import {rpDirDataType} from "@/api/reportCom/type";
import useFileStore from "@/store/modules/file/file";

//data
let props = defineProps(['menuList'])
let systemStore = useSystemStore()
let reportStore = useReportStore()
let fileStore =useFileStore()
/*
函数
*/

/**************************接口函数**************************/


/**************************操作函数**************************/
const handleClick=async (item:rpDirDataType)=>{
  if(item.reportType==='sts'){
    reportStore.setReportLeftItem(item)
    await reportStore.useGetRptime()
    await reportStore.useGetRpResult()
  }else{
    fileStore.setReportLeftItem(item)
    await fileStore.useListByReport()
  }

}
</script>

<script lang="ts">
export default {
  name: 'rpMenuItem'
}
</script>
<style scoped lang="scss">


</style>

